/**
 * Implementacion de la clase ControlEdge.
 */

#include <stdlib.h>
#include <string>
#include <iostream>
#include "controlEdge.hpp"

ControlEdge::ControlEdge() {}

ControlEdge::~ControlEdge() {}

std::string ControlEdge::getEdgeId()
{
	return this->edgeId;
}

void ControlEdge::setEdgeId(std::string id)
{
	this->edgeId.clear();
	this->edgeId = id;
	this->status[0] = 1;
}

std::string ControlEdge::getNodeOriginId()
{
	return this->nodeOriginId;
}
void ControlEdge::setNodeOriginId(std::string origin)
{
	this->nodeOriginId = origin;
	this->status[1] = 1;
}
std::string ControlEdge::getNodeDestinyId()
{
	return this->nodeDestinyId;
}

void ControlEdge::setNodeDestinyId(std::string dest)
{
	this->nodeDestinyId = dest;
	this->status[2] = 1;
}

float ControlEdge::getLongitude()
{
	return this->longitude;
}

void ControlEdge::setLongitude(float longitude)
{
	this->longitude = longitude;
	this->status[3] = 1;
}
float ControlEdge::getVelocity()
{
	return this->vel;
}

void ControlEdge::setVelocity(float vel)
{
	this->vel = vel;
	this->status[4] = 1;
}

int ControlEdge::getEdgeIdStatus()
{
	return this->status[0];
}

int ControlEdge::getNodeOriginIdStatus()
{
	return this->status[1];
}

int ControlEdge::getNodeDestinyIdStatus()
{
	return this->status[2];
}

int ControlEdge::getLongitudeStatus()
{
	return this->status[3];
}

int ControlEdge::getVelocityStatus()
{
	return this->status[4];
}

int ControlEdge::getNumberOfFieldsStatus()
{
	return this->status[5];
}

void ControlEdge::setFailStatus(int fieldNumber)
{
	this->status[fieldNumber-1] = 0;
}

void ControlEdge::setSuccessStatus(int fieldNumber)
{
	this->status[fieldNumber-1] = 1;
}

void ControlEdge::clear()
{
	this->edgeId.clear();
	this->nodeOriginId.clear();
	this->nodeDestinyId.clear();
	this->longitude = 0;
	this->vel = 0;
	for (int i = 0; i < EDGE_STATUS_LEN; i++)
	{
		this->status[i] = 0;
	}
}
